<include file="Public/header" />

</head>

<body>
	<!--page容器-->
	<div class="page-group">
		<div class="page page-current">
			<header class="bar bar-nav search">
				<form class="form-inline">
					<i class="icon icon-menu fr" onclick="showAddress()"></i>
					<a class="button button-link button-nav pull-left back" href="javascript:window.history.go(-1)">
						<span class="icon icon-left"></span>
					</a>
					<h1 class="title">预约学车</h1>
				</form>
			</header>

			<div class="address-list" style="display: none;">
				
			</div>
			<div class="content">
				<div class="time">
					<span>请选择时间</span><input type="text" name="date-time" id="date-time"  readonly="true" value="{$time}" />
				</div>
				<div class="automated">
					<div class="ds-title">
						{$city_name}教练排班
					</div>

					<div class="list-block media-list ds-list" id="MemberInfo">
						<input type="hidden" name="num" id="num" value="{$num}">
						<input type="hidden" name="city" id="city" value="{$city}">
						<input type="hidden" name="city_name" id="city_name" value="{$city_name}">

					</div>

				</div>

				<div id="more" class="more" ><p>加载更多</p></div>
			</div>

		</div>
	</div>
	<script src="__PUBLIC__/app/lib/datePicker.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		var city = '410100';
		var city_name = '{$city_name}';
		var p = 1;
		var theSelectData = '{$time}';
		var num = $('#num').val();
		var school_id = $('#school_id').val();
		city = $('#city').val();

		$(function() {
			getMore(p, theSelectData, city, city_name);
			if(p >= num) {
				$("#more").hide();
			}
		});

		$("#more").click(function() {
			getMore(++p, theSelectData, city, city_name);
			if(p >= num) {
				$("#more").hide();
			}
		});

		$("#date-time").focus(function() {
			document.activeElement.blur();
		});

		function getMore(p, date, city, city_name) {
			$.ajax({
				url: "{:U('info')}",
				data: {
					p: p,
					date: date,
					city: city,
					city_name: city_name
				},
				type: 'post',
				success: function(data) {
					$("#MemberInfo").append(data);
				}
			});

		}

		function getMoreD(p, date) {
			var url = "__APP__/Home/Appointment/index/date/" + theSelectData + "/city/" + city + "/city_name/" + city_name;
			location.href = url;

		}

		/* 日期插件 */
		var calendar = new datePicker();
		calendar.init({
			'trigger': '#date-time',
			/*按钮选择器，用于触发弹出插件*/
			'type': 'date',
			/*模式：date日期；datetime日期时间；time时间；ym年月；*/
			'minDate': '1900-1-1',
			/*最小日期*/
			'maxDate': '2100-12-31',
			/*最大日期*/
			'onSubmit': function() { /*确认时触发事件*/
				theSelectData = calendar.value;
				p = 1;
				//console.log(p,theSelectData);
				getMoreD(p, theSelectData, city, city_name);

			},
			'onClose': function() { /*取消时触发事件*/ }
		});

		/*      根据城市显示预约      */

		function showAddress() {
			$('.address-list').show();
		}
		getCity();

		function getCity() {
			var status = $('#status').val();
			$.ajax({
				url: "{:U('SchoolList/getCity')}",
				type: 'post',
				data: {
					status: status
				},
				success: function(res) {
					$('.address-list').html(res);
				}
			});
		}

		function index_list(id, name) {
			city = id;
			city_name = name;
			console.log(city);
			getMoreD(p, theSelectData, city, city_name);
		}
	</script>

	<script src="http://cdn.bootcss.com/zepto/1.1.6/zepto.min.js"></script>
	<script src="__PUBLIC__/app/lib/h5jssdk.3.0.js"></script>
</body>

<include file="Public/footer" />